package com.zhang.code.api;

import com.zhang.dubbo.api.code.CodeRpcApi;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
public class CodeApi {

    @Reference
    private CodeRpcApi codeService;

    @GetMapping("/genCode/{email}")
    public String genCode(@PathVariable(value = "email") String email){
        return codeService.genCode(email);
    }

    @GetMapping("/checkCode/{email}/{code}")
    public String checkCode(@PathVariable("email") String email, @PathVariable("code") String code){
        return codeService.checkCode(email,code);
    }

}
